using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using System.Text;

public class UIManager : MonoBehaviour
{
    private static UIManager instance;
    public static UIManager Instance
    {
        get
        {
            if (instance == null)
                instance = GameObject.Find("UI Manager").GetComponent<UIManager>();

            return instance;
        }
    }


    public TextMeshProUGUI orbText;
    public TextMeshProUGUI timeText;
    public TextMeshProUGUI deathText;
    public TextMeshProUGUI gameOverText;

    private void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(this);
    }


    public void UpdateOrbUI(int orbCount)
    {
        orbText.text = orbCount.ToString();
    }

    public void UpdateDeathUI(int deathCount)
    {
        deathText.text = deathCount.ToString();
    }

    public void UpdateGameTimeUI(float time)
    {
        int minute = (int)time / 60;
        int second = (int)time % 60;
        timeText.text = string.Format("{0:d2}:{1:d2}", minute, second);
    }

    public void DisplyGameOver()
    {
        gameOverText.enabled = true;
    }
}
